﻿
project(PostProcessing)


add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/utf-8>")
############################################################
# Create an executable
############################################################

#输出目录
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_OUTPUT_BIN_DIR})


#所有.h文件
file(GLOB ALL_HEAD "*.h" "parser/*.h")
#所有.cpp文件
file(GLOB ALL_SOURCE "*.cpp" "parser/*.cpp")
#所有.ui文件
file(GLOB ALL_UI "*.ui")

# 定义QCustomPlot DLL导入符号宏定义
ADD_DEFINITIONS("-DQCUSTOMPLOT_USE_LIBRARY")

SET(DIR_RESOURCES "${CMAKE_SOURCE_DIR}/Resources")
SET(SRC_QRC_FILES 
    "${DIR_RESOURCES}/post.rc" 
    "${DIR_RESOURCES}/startup.qrc" 
    "${DIR_RESOURCES}/image.qrc"
    "${LIBRARY_ElaWidgetTools_INCLUDE}/ElaWidgetTools.qrc"
)

add_executable(${PROJECT_NAME} WIN32 
    ${ALL_HEAD}
    ${ALL_SOURCE}
    ${ALL_UI}
    ${SRC_QRC_FILES}
)

# 包含头文件目录
TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} 
    PRIVATE
    ${CMAKE_SOURCE_DIR}
    ${LIBRARY_VTK_INCLUDE}
)

# 配置编译选项
IF(CMAKE_SYSTEM_NAME MATCHES "Windows")
    SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Zi")
    SET(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /DEBUG /OPT:REF /OPT:ICF")
ENDIF()    


find_package(Qt5 COMPONENTS Core Widgets REQUIRED)
target_link_libraries(${PROJECT_NAME} Qt5::Core Qt5::Widgets)

TARGET_LINK_DIRECTORIES(${PROJECT_NAME} PRIVATE ${PROJECT_OUTPUT_BIN_DIR})
TARGET_LINK_LIBRARIES(${PROJECT_NAME} BaseModule)
ADD_DEPENDENCIES(${PROJECT_NAME} BaseModule)

#vld路径设置
SET(VLD_DIR ${LIBRARY_THIRDPARTY_DIR}/Libs/windows-x86_64/vld-2.5.1)
FILE(COPY ${VLD_DIR}/bin/vld_x64.dll  DESTINATION ${PROJECT_OUTPUT_BIN_DIR})

INCLUDE_DIRECTORIES(${VLD_DIR}/include ${LIBRARY_ElaWidgetTools_INCLUDE} ${LIBRARY_QCustomPlot_INCLUDE})

#UI组件库
FILE(COPY ${LIBRARY_ElaWidgetTools_BINS}  DESTINATION ${PROJECT_OUTPUT_BIN_DIR})

#QCustomPlot组件库
FILE(COPY ${LIBRARY_QCustomPlot_BINS}  DESTINATION ${PROJECT_OUTPUT_BIN_DIR})

MESSAGE(STATUS "Start copying Python Module Script files and Geometry Model and Config Files.")
FILE(COPY ${CMAKE_SOURCE_DIR}/Resources/Fonts DESTINATION ${PROJECT_OUTPUT_BIN_DIR})

target_link_libraries(${PROJECT_NAME} ${VLD_DIR}/lib/vld.lib)
target_link_libraries(${PROJECT_NAME} ${LIBRARY_VTK_LIBS} ${LIBRARY_ElaWidgetTools_LIBS} ${LIBRARY_QCustomPlot_LIBS})

